package com.jyw.business.obstacles.enums;

import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * <br>
 * 字段转义
 * @author lichunjiang
 * @date 2022/7/4
 */
@Getter
public enum OrderFieldsEnum {
    /**
     * 字段转义
     */
    SOURCE("source", "来源"),
    FAULT_TYPE("faultType", "故障分类"),
    NEED_TIME("needTime", "所需工时"),
    FAULT_REMARK("faultRemark", "故障描述"),
    DETAIL_INFO("detailInfo", "详细说明"),
    DEGREE("degree", "紧急程度"),
    RANGE_TYPE("rangeType", "影响范围"),
    RESPONSE_TYPE("responseType", "响应类型"),
    COMPLETE_TIME("completeTime", "完成时间"),
    REQ_TIME("reqTime", "预计工时"),
    PHONE("phone", "报修电话 "),
    RECEPTION("reception", "服务台"),
    PLACE("place", "报修地址"),
    USER("user", "报修人"),
    DEPT_ID("deptId", "报修科室"),
    EQUIPMENT("equipment","资产名称"),
    EQUIPMENT_ADDRESS("equipmentAddress","资产位置"),

    ACTUAL_REPAIR_PLACE("actualRepairPlace", "实际报修地址"),
    APPOINTMENT("appointment", "预约时间"),
    ENCLOSURE("enclosureId", "附件");

    private String code;

    private String desc;

    OrderFieldsEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static Map<String, String> fieldsMap;
    public static Map<String, String> getMap() {
        if (fieldsMap == null) {
            fieldsMap = Arrays.stream(OrderFieldsEnum.values()).collect(Collectors.toMap(OrderFieldsEnum::getCode, OrderFieldsEnum::getDesc));
        }
        return fieldsMap;
    }
}
